const DeviceInfo = require('react-native-device-info');
import { Platform } from 'react-native';

export const getDeviceInfo = () => {
  const isAndroid = Platform.OS === 'android';
  let deviceInfo = {
      "unique_id": DeviceInfo.getUniqueID(),
      "manufacturer": DeviceInfo.getManufacturer(),
      "brand": DeviceInfo.getBrand(),
      "model": DeviceInfo.getModel(),
      "system_name": DeviceInfo.getSystemName(),
      "system_version": DeviceInfo.getSystemVersion(),
      "user_agent": DeviceInfo.getUserAgent(),
      "device_name": DeviceInfo.getDeviceName(),
      "device_locale": DeviceInfo.getDeviceLocale(),
      "time_zone": DeviceInfo.getTimezone(),
      "bundle_id": DeviceInfo.getBundleId(),
      "bundle_number": DeviceInfo.getBuildNumber(),
      "is_emulator": DeviceInfo.isEmulator() ? 1 : 2,
      "is_tablet": DeviceInfo.isTablet() ? 1 : 2,
      "api_level": isAndroid ? DeviceInfo.getAPILevel() : null,
      "instance_id": isAndroid ? DeviceInfo.getAPILevel() : null,
      "phone_number": isAndroid ? DeviceInfo.getPhoneNumber() : null,
      "first_install_time": isAndroid ? DeviceInfo.getFirstInstallTime() : null,
      "last_install_time": isAndroid ? DeviceInfo.getLastUpdateTime() : null,
      "serial_number": isAndroid ? DeviceInfo.getSerialNumber() : null,
      "ip_address": null,
      "mac_address": null
  }
  return deviceInfo;
}